#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    : 2023/11/27 22:41
# @function: the script is used to do something.
# @version : 


import re

# 从头开始匹配
# s. 表示匹配以"s"开头的两个字符
# res = re.match('s.', 'sfdfgjdnsd')
# print(res.group())  # 返回 sf

# res = re.match('t.o', 'two')
# print(res.group())  # 返回 two

# [] 匹配括号中列举的数据
# result = re.match('[234234234]hello python', '3hello python')
# print(result.group())  # 返回 3hello python

# \d 匹配数字
# ret = re.match('嫦娥\d\d号', '嫦娥10号发射成功')
# print(ret.group())  # 返回 嫦娥10号

# \D 匹配非数字
# ret = re.match('\D', 'jiu')
# print(ret.group())  # 返回 j

# \s 匹配空白
# ret = re.match('hello\sworld', 'hello\tworld')
# print(ret.group())  # 返回 hello	world

# \S 匹配非空白
# ret = re.match('hello\Sworld', 'hello喊world')
# print(ret.group())  # 返回 hello喊world

# \w 匹配非特殊字符 a-z A-Z _ 汉字
# ret = re.match('\w', '好好好')
# print(ret.group())  # 返回好

# \W 匹配特殊字符
ret = re.match('\W', '%$')
print(ret.group())  # 返回#

